﻿<!DOCTYPE HTML>
<html>
<head>
    <script id="allmobilize" charset="utf-8" src="/js/allmobilize.min.js"></script>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="alternate" media="handheld"/>
    <!-- end 云适配 -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>找回密码-拉勾网-最专业的互联网招聘平台</title>
    <meta property="qc:admins" content="23635710066417756375"/>
    <meta content="拉勾网是3W旗下的互联网领域垂直招聘网站,互联网职业机会尽在拉勾网" name="description">
    <meta content="拉勾,拉勾网,拉勾招聘,拉钩, 拉钩网 ,互联网招聘,拉勾互联网招聘, 移动互联网招聘, 垂直互联网招聘, 微信招聘, 微博招聘, 拉勾官网, 拉勾百科,跳槽, 高薪职位, 互联网圈子, IT招聘, 职场招聘, 猎头招聘,O2O招聘, LBS招聘, 社交招聘, 校园招聘, 校招,社会招聘,社招"
          name="keywords">


    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
    <script src="/js/jquery.1.10.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/js/jquery.lib.min.js"></script>

</head>

<body id="login_bg">
<div class="login_wrapper">
    <div class="login_header">
        <a href="index.html"><img src="/images/logo_white.png" width="285" height="62" alt="拉勾招聘"/></a>
        <div id="cloud_s"><img src="/images/cloud_s.png" width="81" height="52" alt="cloud"/></div>
        <div id="cloud_m"><img src="/images/cloud_m.png" width="136" height="95" alt="cloud"/></div>
    </div>

    <input type="hidden" id="resubmitToken" value=""/>
    <div class="find_psw" id="first" >
        <form action="#" onsubmit="return false">
            <img src="/images/psw_step1.png" width="369" height="56" alt="找回密码第一步"/>
            <input type="text" name="email" id="email" tabindex="1" value="" placeholder="请输入注册时使用的邮箱地址"/>
            <span class="error" id="beError"></span>
            <input type="submit" onclick="checkPwd();" id="submitLogin" value="下一步"/>
        </form>
    </div>

    <div class="find_psw" id="second" style="display: none;">
        <form action="#" onsubmit="return false">
            <img src="/images/psw_step2.png" width="369" height="56" alt="验证验证码"/>
            <input type="text" name="verifyCode" id="verifyCode" tabindex="1" value="" placeholder="验证验证码"/>
            <span class="error" id="beError_2"></span>
            <input type="submit" onclick="verifyEmail();" id="submitLogin" value="下一步"/>
        </form>
    </div>

    <div class="find_psw" id="third" style="display: none;">
        <form action="#" id="password_new" onsubmit="return false">
            <img src="/images/psw_step3.png" width="369" height="56" alt="新的密码"/>
            <input type="text" name="newPwd" id="newPwd" tabindex="1" value="" placeholder="请输入新的密码"/>
            <span class="error" id="beError_3"></span>
            <input type="submit" onclick="newPassword();" id="submitLogin" value="完成"/>
        </form>
    </div>


</div>

<script type="text/javascript">
    var email;

    // 表单验证通过之后去数据库查询数据
    function checkPwd() {
        // 设计页面提示 因为邮件可能发的比较慢
        $('#beError').text("请稍等，正在发送邮件......").show();
        // 设计未发送成功的时候 “下一步” 按钮不可以点击

        // 获取邮件的值
        email = $("#email").val();
        $.ajax({
            url: '/user/checkPwd.html?email=' + email,
            success: function (result) {
                if (result.code == 2) {
                    $("#first").css('display', 'none');
                    $("#second").css('display', 'block');
                } else {
                    $('#beError').text(result.msg).show();
                    return false;
                }
            }
        })
    }

    // 验证验证码
    function verifyEmail() {
        // 获取验证码的值
        var verifyCode = $("#verifyCode").val();
        $.ajax({
            url: '/user/verifyCode.html?verifyCode=' + verifyCode,
            success: function (result) {
                console.log(result);
                if (result.code == 2) {
                    // 验证成功了
                    $("#second").css('display', 'none');
                    $("#third").css('display', 'block');
                } else {
                    $('#beError_2').text(result.msg).show();
                    return false;
                }
            }
        })
    }

    // 重置密码
    function newPassword() {
        // 获取新的密码
        var newPwd = $("#newPwd").val();
        alert(email);
        $.ajax({
            url: '/user/updatePwd.html?email=' + email + '&newPwd=' + newPwd,
            success: function (result) {
                // 更新成功
                if (result.code == 2) {
                    window.location.href = '/page/login.html';
                } else {
                    $('#beError_3').text(result.msg).show();
                    return false;
                }
            }
        })
    }


</script>
</body>
</html>
